package com.we.scrm.common.enums;

import com.we.scrm.bean.simpleObj;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *会员级别：
 *0-普通用户，1-普通会员，2-白银用户，3-黄金用户，4-白金会员，5-黑金会员，6-钻石用户
 **/

public enum CustomerLevelEnum {

    NORMAL(0,"普通用户"),

    CUSTOMER(1, "会员"),

    SILVER(2, "白银会员"),

    GOLD(3, "黄金会员"),

    WHITEGOLD(4, "白金会员"),

    BLANKGOLD(5, "黑金会员"),

    DIAMOND(6, "钻石会员"),

    ;

    private Integer code;
    private String name;

    CustomerLevelEnum(Integer code, String name){
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getNameByCode(Integer value){
        for(CustomerLevelEnum item : CustomerLevelEnum.values()){
            if(item.code.equals(value)){
                return item.getName();
            }
        }
        return null;
    }


    public static List<simpleObj> toList(){

        List<simpleObj> list = new ArrayList<simpleObj>();
        for(CustomerLevelEnum item : CustomerLevelEnum.values()){
            simpleObj obj = new simpleObj(item.code,item.name);
            list.add(obj);
        }
        return list;
    }

}
